import axios from 'axios'
import { GetToken } from '@/utils/storage'

const instance = axios.create({
  baseURL: 'http://ttapi.research.itcast.cn/', timeout: 5000
})

instance.interceptors.request.use(function(config){
  const token = GetToken()
  if(token){
    config.headers.Authorization='Bearer ' + token
  }
  //console.log('拦截',config);
  return config
},
function(error){
  return Promise.reject(error)
}
)

export default instance
